package com.yxq.mdt.app.modules.socialcontact.adapter;


import androidx.annotation.Nullable;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.yxq.mdt.app.R;
import com.yxq.mdt.app.glide.GlideHelper;
import com.yxq.mdt.app.modules.socialcontact.bean.SocialAllListMember;

import java.util.List;

public class CircleAllListAdapter extends BaseQuickAdapter<SocialAllListMember.DataBean.ListBean, BaseViewHolder> {
    public CircleAllListAdapter(int layoutResId, @Nullable List<SocialAllListMember.DataBean.ListBean> data) {
        super(layoutResId, data);
    }

    @Override
    protected void convert(BaseViewHolder helper, SocialAllListMember.DataBean.ListBean item) {
        helper.addOnClickListener(R.id.circle_img_all);
        helper.addOnClickListener(R.id.circle_attention_tv_all);
        GlideHelper.setLoadRoundImage(mContext, item.getHeadimg(), R.mipmap.head_icon, helper.getView(R.id.circle_img_all));
        helper.setText(R.id.circle_nike_name, item.getUserName());
        if (item.getSex() == 2) {
            helper.setImageResource(R.id.circle_sex_img, R.mipmap.xb_nv);
        } else {
            helper.setImageResource(R.id.circle_sex_img, R.mipmap.xb_nan);
        }
        if (item.isOwner()) {
            helper.setGone(R.id.circle_is_circle_tv, true);
        } else {
            helper.setGone(R.id.circle_is_circle_tv, false);
        }
        if (item.getGeneration() != null) {
            helper.setText(R.id.circle_introduce_tv, item.getGeneration());
        } else {
            helper.setText(R.id.circle_introduce_tv, "");
        }
        if (String.valueOf(item.getAge()) != null) {
            if (item.getAge() != 0) {
                helper.setText(R.id.circle_year_tv, item.getAge() + "岁");
            } else {
                helper.setText(R.id.circle_year_tv, "");
            }
        } else {
            helper.setText(R.id.circle_year_tv, "");
        }
        if (item.getConstellation() != null) {
            helper.setText(R.id.circle_constellation_tv, item.getConstellation());
        } else {
            helper.setText(R.id.circle_constellation_tv, "");
        }
        if (item.getResidence() != null) {
            helper.setText(R.id.circle_city_tv, item.getResidence());
        } else {
            helper.setText(R.id.circle_city_tv, "");
        }
        if (item.getCompany() > 0) {
            helper.setText(R.id.circle_attention_tv_all, "已关注");
        } else {
            helper.setText(R.id.circle_attention_tv_all, "关注");
        }

    }


}
